﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class CalendarManage_AddSchaddup : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null)
        {
            Response.Write("<script>alert('请先登录!');window.location.href='../Login.aspx'</script>");
        }
      
    }


    protected void bnSave_ServerClick(object sender, EventArgs e)
    {
        if (txDes.Value.Trim() == "")
        {
            Response.Write("<script>alert('请输入内容！！')</script>");
        }
        else
        {
            string UserName = Session["UserName"].ToString();
            SqlInsert sl = new SqlInsert();
            Sqlselete ss = new Sqlselete();
            int TeacherID = ss.SelectTeacherID(UserName);
            string Motif = this.txName.Value.Trim();
            string Content = this.txDes.Value.Trim();
            string AddTime = this.TextBox2.Text.Trim();
            sl.InsertCalendar(TeacherID, Motif, Content, AddTime);
            Response.Write("<script>alert('添加成功！');window.close();</script>");
        }   
    }
}
